package prj.common.web.tag;

import javax.faces.component.UIComponent;

import com.sun.faces.taglib.html_basic.GraphicImageTag;

public class CaptchaTag extends GraphicImageTag {
    // Setter Methods
    // PROPERTY: captchaField
    private javax.el.ValueExpression captchaField;
    public void setUrl(javax.el.ValueExpression captchaField) {
        this.captchaField = captchaField;
    }

    // General Methods
    public String getRendererType() {
        return "prj.common.CaptchaRenderer";
    }

    public String getComponentType() {
        return "prj.common.Captcha";
    }

    protected void setProperties(UIComponent component) {
        super.setProperties(component);
        javax.faces.component.UIGraphic graphic = null;
        try {
            graphic = (javax.faces.component.UIGraphic) component;
        } catch (ClassCastException cce) {
            throw new IllegalStateException("Component " + component.toString() + " not expected type.  Expected: javax.faces.component.UIGraphic.  Perhaps you're missing a tag?");
        }

        if (captchaField != null) {
            graphic.setValueExpression("captchaField", captchaField);
        }
    }
    
    public void release() {
        super.release();

        this.captchaField = null;
    }
}
